package com.jacen.fzxs.service.app.impl;

import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.jacen.fzxs.entity.ImageEntity;
import com.jacen.fzxs.entity.WallEntity;
import com.jacen.fzxs.entity.web.AppEntity;
import com.jacen.fzxs.entity.web.Wall;
import com.jacen.fzxs.exception.WebException;
import com.jacen.fzxs.service.IImageService;
import com.jacen.fzxs.service.IWallService;

@Service
@Transactional(rollbackFor = Exception.class)
public class WallInfoHandlerService extends BaseHandlerService {
	@Resource
	private IWallService wallService;
	@Resource
	private IImageService imageService;

	@Override
	protected AppEntity submit(AppEntity appEntity,HttpServletRequest request) throws WebException {
		AppEntity resAppEntity = new AppEntity();
		String wallId = appEntity.getWallId();
		WallEntity wall = wallService.getById(wallId);
		List<ImageEntity> images = imageService.getList(wallId);
		
		resAppEntity.setWall(Wall.turnToWall(wall));
		resAppEntity.setImages(images);
		return resAppEntity;
	}

}
